//
//  HyTableViewCell.m
//  BaiSiBuDeJie
//
//  Created by uproject on 16/8/29.
//  Copyright © 2016年 tsaievan. All rights reserved.
//

#import "HyTableViewCell.h"
#import "BSBaseModel.h"

@interface HyTableViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *headImg;

@property (weak, nonatomic) IBOutlet UILabel *userName;
@property (weak, nonatomic) IBOutlet UILabel *issueTime;
@property (weak, nonatomic) IBOutlet UIImageView *isVip;
@property (weak, nonatomic) IBOutlet UIImageView *yellowDiamond;
@property (weak, nonatomic) IBOutlet UILabel *text;
@property (weak, nonatomic) IBOutlet UIWebView *mainView;
@property (weak, nonatomic) IBOutlet UILabel *playCount;
@property (weak, nonatomic) IBOutlet UILabel *time;
@property (weak, nonatomic) IBOutlet UIButton *upBtn;
@property (weak, nonatomic) IBOutlet UIButton *downBtn;
@property (weak, nonatomic) IBOutlet UIButton *shareBtn;
@property (weak, nonatomic) IBOutlet UIButton *commentBtn;

@end
@implementation HyTableViewCell

- (void)setModel:(ListModel *)model{
    _model = model;
    //头像
    NSArray *urlArr = model.u.header;
    [self.headImg sd_setImageWithURL:urlArr[0]];
    self.headImg.layer.cornerRadius = self.headImg.bounds.size.width * 0.5;
    [self.headImg clipsToBounds];
    //vip
    if (model.u.is_v) {
        self.isVip.image = [UIImage imageNamed:@"Profile_AddV_authen"];
        self.userName.textColor = [UIColor redColor];
    }else{self.isVip.image = nil;}
    
    //昵称
    self.userName.text = model.u.name;
    
    //发表时间
    self.issueTime.text = model.passtime;
    
    //标题
    self.text.text = model.text;
    //标签
    //先移除
    
    //点赞数
    [self.upBtn setTitle:model.up forState:UIControlStateNormal];
    self.upBtn.selected = self.model.upBtnStatus;
    if (model.upBtnStatus) {
        [self.upBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    }else{ [self.upBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];}
    
    
    //不赞
    [self.downBtn setTitle:[NSString stringWithFormat:@"%zd",model.down] forState:UIControlStateNormal];
    self.downBtn.selected = self.model.downBtnStatus;
    
    if (model.downBtnStatus) {
        [self.downBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    }else{ [self.downBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];}
    
    //转载
    [self.shareBtn setTitle:[NSString stringWithFormat:@"%zd",model.forward] forState:UIControlStateNormal];
    
    //评论数
    [self.commentBtn setTitle:[NSString stringWithFormat:@"%@",model.comment] forState:UIControlStateNormal];
    
    
}
    
    

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}

@end
